﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MaxLeaf.Common;
using MaxLeaf.DB;
using System.Data;
using MySql.Data.MySqlClient;
using System.Data.SqlClient;
 

namespace MaxLeaf.DAL.Web2SCP
{
   

    public class goods_attributeDAL : BaseDAL
    {
        public goods_attributeDAL()
            : base()
        {
            strSCPTableName = "goods_attribute";
            strWebTableName = "goods_attribute";

            strSCPKeyFieldName = "goods_attr_id";
            strWebKeyFieldName = "goods_attr_id";





            strFieldNames = "goods_id,attr_id,attr_value,attr_v_id";
 
        }

        public override int Update(DBAccess dbOrgWebReadCon, DBAccess dbOrgWebWriteCon, DBAccess dbDestSCPCon, string strKeyValue)
        {
            int intDestKeyValue = base.Update(dbOrgWebReadCon, dbOrgWebWriteCon, dbDestSCPCon, strKeyValue);

            KeyValuePair<string,IDataParameter[]> kvp=dbDestSCPCon.CreateCondParam(new Dictionary<string,object>(){{strSCPKeyFieldName,intDestKeyValue}});
            DataRow drData = dbDestSCPCon.GetDataFirstRow(string.Format("select * from {1} where {0}", kvp.Key,strSCPTableName), kvp.Value);
            new ImInvMasterDAL().RefreshData(dbDestSCPCon, CvtFunc.ToInt(drData["goods_id"]));

            return intDestKeyValue;
        }

              
    }
}